import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)
//配路由的文件

import { menus } from "@/utils/menus";
const routes = [
  //路由懒加载
 {path:"/",redirect:"/login"},
 {path:"/login",name:"login",component:()=>import("@/views/Login.vue")},
 {
   path:"/index",
   name:"index",
   component:()=>import("@/views/Index.vue"),
   redirect:"/index/home",
   children:[
     ...menus  //解构重定向到
   ]
  },
 {path:"/404",name:"notFound",component:()=>import("@/views/errPage/404.vue")},
 {path:"*",redirect:{name:"notFound"}},
]

const router = new VueRouter({
  mode: 'hash',
  base: "",
  routes
})

export default router
